<?php
/**
 * Magento
 *
 * NOTICE OF LICENSE
 *
 * This source file is subject to the Academic Free License (AFL 3.0)
 * that is bundled with this package in the file LICENSE_AFL.txt.
 * It is also available through the world-wide-web at this URL:
 * http://opensource.org/licenses/afl-3.0.php
 * If you did not receive a copy of the license and are unable to
 * obtain it through the world-wide-web, please send an email
 * to license@magentocommerce.com so we can send you a copy immediately.
 *
 * DISCLAIMER
 *
 * Do not edit or add to this file if you wish to upgrade Magento to newer
 * versions in the future. If you wish to customize Magento for your
 * needs please refer to http://www.magentocommerce.com for more information.
 *
 * @category   design_blank
 * @package    Mage
 * @copyright  Copyright (c) 2008 Irubin Consulting Inc. DBA Varien (http://www.varien.com)
 * @license    http://opensource.org/licenses/afl-3.0.php  Academic Free License (AFL 3.0)
 */
?>
<div class="page-title">
    <h2><?php echo $this->__('Edit Account Information') ?></h2>
</div>
<?php echo $this->getMessagesBlock()->getGroupedHtml() ?>
<form action="<?php echo $this->getUrl('customer/account/editPost') ?>" method="post" id="form-validate">
<?php echo $this->getBlockHtml('formkey')?>
<fieldset class="group-select">
    <h3><?php echo $this->__('Account Information') ?></h3>
    <ul>
        <li>
            <?php echo $this->getLayout()->createBlock('customer/widget_name')->setObject($this->getCustomer())->toHtml() ?>
        </li>
        <li>
            <div class="input-box">
                <label for="email"><?php echo $this->__('Email Address') ?> <span class="required">*</span></label><br />
                <input type="text" name="email" id="email" value="<?php echo $this->htmlEscape($this->getCustomer()->getEmail()) ?>" title="<?php echo $this->__('Email Address') ?>" class="input-text required-entry validate-email" />
            </div>
        </li>
<?php $_dob = $this->getLayout()->createBlock('customer/widget_dob') ?>
<?php if ($_dob->isEnabled()): ?>
        <li><?php echo $_dob->setDate($this->getCustomer()->getDob())->toHtml() ?></li>
<?php endif ?>
<?php $_taxvat = $this->getLayout()->createBlock('customer/widget_taxvat') ?>
<?php if ($_taxvat->isEnabled()): ?>
        <li><?php echo $_taxvat->setTaxvat($this->getCustomer()->getTaxvat())->toHtml() ?></li>
<?php endif ?>
    </ul>
</fieldset>
<p><input type="checkbox" name="change_password" id="change_password" value="1" onclick="setPasswordForm(this.checked)" title="<?php echo $this->__('Change Password') ?>"<?php if($this->getCustomer()->getChangePassword()==1): ?> checked="checked"<?php endif; ?> class="checkbox" /> <label for="change_password"><?php echo $this->__('Change Password') ?></label></p>
<fieldset class="group-select" style="display:none;">
    <h3><?php echo $this->__('Change Password') ?></h3>
    <ul>
        <li>
            <div class="input-box">
                <label for="current_password"><?php echo $this->__('Current Password') ?></label><br />
                <input type="password" class="input-text" name="current_password" id="current_password" />
            </div>
        </li>
        <li>
            <div class="input-box">
                <label for="password"><?php echo $this->__('New Password') ?></label><br />
                <input type="password" class="input-text validate-password" name="password" id="password" />
            </div>
            <div class="input-box">
                <label for="confirmation"><?php echo $this->__('Confirm New Password') ?></label><br />
                <input type="password" class="input-text validate-cpassword" name="confirmation" id="confirmation" />
            </div>
        </li>
    </ul>
</fieldset>
<p class="required"><?php echo $this->__('* Required Fields') ?></p>
<div class="buttons-set"><div class="floatbox">
    <a href="<?php echo $this->getBackUrl() ?>" class="back-link">&laquo; <?php echo $this->__('Back') ?></a>
    <button type="submit" class="button"><span><?php echo $this->__('Save') ?></span></button>
</div></div>
</form>
<script type="text/javascript">
//<![CDATA[
    var dataForm = new VarienForm('form-validate', true);
    function setPasswordForm(arg){
        if(arg){
            $('current_password').up(3).show();
            $('current_password').addClassName('required-entry');
            $('password').addClassName('required-entry');
            $('confirmation').addClassName('required-entry');

        }else{
            $('current_password').up(3).hide();
            $('current_password').removeClassName('required-entry');
            $('password').removeClassName('required-entry');
            $('confirmation').removeClassName('required-entry');
        }
    }
    <?php if($this->getCustomer()->getChangePassword()): ?>
        setPasswordForm(true);
    <?php endif; ?>
//]]>
</script>
